<template>
  <el-row class="tables">
    <!-- 表格 头部 -->
    <el-row class="tableTh">
      <el-col :span="2">
        <span>订单号</span>
      </el-col>
      <el-col :span="6">
        <span>客户名称</span>
      </el-col>
      <el-col :span="2">
        <span>产品编码</span>
      </el-col>
      <el-col :span="2">
        <span>产品名称</span>
      </el-col>
      <el-col :span="2">
        <span>产品单位</span>
      </el-col>
      <el-col :span="1">
        <span>订单数</span>
      </el-col>
      <el-col :span="1">
        <span>完成数</span>
      </el-col>
      <el-col :span="2">
        <span>未完成数</span>
      </el-col>
      <el-col :span="3">
        <span>下单日期</span>
      </el-col>
      <el-col :span="2">
        <span>状态显示</span>
      </el-col>
    </el-row>
    <!-- 表格行 -->
    <div v-if="tableData.length > 0" class="showDiv">
      <el-row v-for="(item,index) in tableData" :class="{ 'row-striped': index % 2 === 1 }" :key="item.id" class="tableTd">
        <el-col :span="2">
          <span>{{ item.saleNo }}</span>
        </el-col>
        <el-col :span="6">
          <span>{{ item.customerName }}</span>
        </el-col>
        <el-col :span="2">
          <span>{{ item.materialCode }}</span>
        </el-col>
        <el-col :span="2">
          <span>{{ item.materialName }}</span>
        </el-col>
        <el-col :span="2">
          <span>{{ item.unit }}</span>
        </el-col>
        <el-col :span="1">
          <span>{{ item.num}}</span>
        </el-col>
        <el-col :span="1">
          <span>{{ item.finishNum}}</span>
        </el-col>
        <el-col :span="2">
          <span>{{ item.unFinishNum}}</span>
        </el-col>
        <el-col :span="3">
          <span>{{ item.saleDate}}</span>
        </el-col>
        <el-col :span="2">
          <span :class="item.statusStr === '加工中' ? 'blue' : item.statusStr === '已完成' ? 'green':'yellow'">{{item.statusStr}}</span>
        </el-col>
      </el-row>
    </div>
    <div v-else class="kong">暂无数据</div>
  </el-row>
</template>
<script>
export default {
  props: {
    // tableData: {
    //   type: Array,
    //   default: []
    // }
  },
  data() {
    return {
      tableData: [
        {
          orderNo: '21NE02624-25',
          code: 'AH1001561',
          pp: '徽岳记',
          model: '徽岳记2号170粒',
          kouwei: '奶油味',
          num: '75',
          wnum: '75',
          wwnum: '85',
          time: '2022-12-10',
          status: '加工中'
        },
        {
          orderNo: '21NE02624-25',
          code: 'AH1001561',
          pp: '徽岳记',
          model: '徽岳记2号170粒',
          kouwei: '奶油味',
          num: '75',
          wnum: '75',
          wwnum: '85',
          time: '2022-12-10',
          status: '已完成'
        },
        {
          orderNo: '21NE02624-25',
          code: 'AH1001561',
          pp: '徽岳记',
          model: '徽岳记2号170粒',
          kouwei: '奶油味',
          num: '75',
          wnum: '75',
          wwnum: '85',
          time: '2022-12-10',
          status: '待加工'
        },
        {
          orderNo: '21NE02624-25',
          code: 'AH1001561',
          pp: '徽岳记',
          model: '徽岳记2号170粒',
          kouwei: '奶油味',
          num: '75',
          wnum: '75',
          wwnum: '85',
          time: '2022-12-10',
          status: '加工中'
        },
        {
          orderNo: '21NE02624-25',
          code: 'AH1001561',
          pp: '徽岳记',
          model: '徽岳记2号170粒',
          kouwei: '奶油味',
          num: '75',
          wnum: '75',
          wwnum: '85',
          time: '2022-12-10',
          status: '加工中'
        },
        {
          orderNo: '21NE02624-25',
          code: 'AH1001561',
          pp: '徽岳记',
          model: '徽岳记2号170粒',
          kouwei: '奶油味',
          num: '75',
          wnum: '75',
          wwnum: '85',
          time: '2022-12-10',
          status: '加工中'
        }
      ]
    }
  },
  watch: {},
  mounted() {},
  methods: {
    /* 获取订单实时采集 */
    async getTabInfo() {
      const res = await this.$axios.get('/board/internetData/orderRealData')
      if (res?.data.code === 200) {
        this.tableData = res.data.data
      }
    }
  }
}
</script>
<style lang='scss' scoped>
.row-striped {
  background-color: rgba(255, 255, 255, 0.5); /* 背景色可以根据需要自定义 */
}
.blue {
  background: #4a9fe2;
  border-radius: 10px;
}
.green {
  background: #00ff00;
  border-radius: 10px;
  color: #333;
}
.yellow {
  background: #ff931e;
  border-radius: 10px;
}
.tables {
  height: calc(100% - 65px);
  color: #fff;
  background: none;
  margin: 0 10px;
  .showDiv {
    height: 85%;
  }
  .tableTh,
  .tableTd {
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    .el-col {
      text-overflow: ellipsis; /*让截断的文字显示为点点。还有一个值是clip意截断不显示点点*/
      white-space: nowrap; /*让文字不换行*/
      overflow: hidden; /*超出要隐藏*/
    }
  }
  .tableTh {
    width: 100%;
    height: 15%;
    // font-weight: bold;
    font-size: 12px;
    background: rgba(0, 255, 255, 0.5);
    color: #ceffff;
  }
  .tableTd {
    height: 16.666666%;
    font-size: 12px;
    // font-weight: bold;
    span {
      width: 100%;
      height: 100%;
      display: block;
    }
  }
  .kong {
    height: calc(100% - 65px);
    // background: url(../../../../assets/images/zwsj.png) no-repeat center;
    background-size: 50% auto;
    display: flex;
    align-items: center;
    justify-content: center; /*定义body的里的元素水平居中*/
    color: #fff;
    font-size: 0.8vw;
  }
}
</style>
